import json
import requests


r = requests.get(
    url='http://10.255.5.133:9220/frc/logs/_search',
    auth=('jrfk', 'jfdha15LuMi9BqO011'),
    json={
        'from': 0,
        'size': 100,
        'query': {
            'filtered': {
                'filter': {
                    'range': {
                        'query_time.raw': {
                            'gte': '2017-06-03 00:00:00,000',
                            'lte': '2017-06-09 00:00:00,000'
                        }
                    }
                }
            }
        },
        'aggs': {
            'group_by_user': {
                'terms': {'field': 'custom.raw'},
                'aggs': {
                    'group_by_action': {
                        'terms': {'field': 'action'},
                    },
                    'group_by_scene': {
                        'terms': {'field': 'scene'},
                    }
                }
            }
        }
    })

print(json.dumps(r.json(), ensure_ascii=False, indent=4))
